function searchForm(){
	document.indexForm .submit();
}

function trim(str){
    return str.replace(/(^\s*)|(\s*$)/g,"");
}//去掉空格

function checkaddForm(){
	
	var ch_name = document.getElementById('ch_name') .value;
	if(trim(ch_name)==null || trim(ch_name)==""){
		alert("栏目名称不能为空！");
		document.getElementById('ch_name').focus();
		return false;
	}
	var order_no = document.getElementById('order_no') .value;
	if(order_no==null || order_no==""){
		document.getElementById('order_no').value='0';
	}
	document.addForm.submit();
}

function checkupdatefrom(){
	var ch_name = document.getElementById('ch_name') .value;
	if(trim(ch_name)==null || trim(ch_name)==""){
		alert("栏目名称不能为空！");
		document.getElementById('ch_name').focus();
		return false;
	}
	var order_no = document.getElementById('order_no') .value;
	if(order_no==null || order_no==""){
		document.getElementById('order_no').value='0';
	}
	
	document.updateForm .submit();
}

function delIndexInfo(){
	var listsize = document.getElementById('listsize').value;
	var ifdown ='';
	var pkid_string = '';
	for(var i=0;i<listsize;i++){
		if(document.getElementById('checkone'+i).checked){
			pkid_string += document.getElementById('checkone'+i).value+'|';
		}
	}
	
	for(var i=0;i<listsize;i++){
					if(document.getElementById('checkone'+i).checked){
					 if(document.getElementById('child'+i).value=='1'){
					 	  ifdown=1;
					 	  break;
					 	}
					}
				} 
	if(pkid_string == ''){
		alert('请至少选择一条!');
		return false;
	}
	else{
	document.getElementById('pkid').value = pkid_string;
	document.indexForm.action='/doTradeReg.do';
	
	if(ifdown =='1'){
            
		       if(window.confirm( '所选择含有下级栏目，请先删除下级')){				    
			   	     return false;
		       } 
	      }
	else{
		if(window.confirm('确定要删除吗？')){
		document.indexForm.submit();
		}
	}
 }
}

function delOneNews(val1,val2){
	  var ifdown= document.getElementById('child'+val1);
		if(ifdown !=null && ifdown.value=='1')
		{
			if(window.confirm("该栏目含有下级，请先删除下级"))
			{
		  		window.history.go(0);
			}
		}
		else
		{
        if(window.confirm('确定要删除吗?'))
        {
       	  window.location.href='/doTradeReg.do?pkid='+val2+'&bpm_id=3336'; 
        } 		
    }
}

//限制数字全角状态输入 允许中文输入
function   clearSBC(){ 
window.clipboardData.setData( 'text ',clipboardData.getData( 'text ').replace(/[\uFF00-\uFFFF]/g, ' ')) 
}